package example2;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

public class InetAddressTest {
    public static void main(String args[]) throws UnknownHostException {
        InetAddress inetAddress = InetAddress.getLocalHost();
        inetAddress = InetAddress.getByName("www.qq.com");

        System.out.println(inetAddress.getHostName());
        System.out.println(inetAddress.getHostAddress());
        byte bytes[] = inetAddress.getAddress();
        System.out.println(Arrays.toString(bytes));

    }
}



